


import os , sys
# 获取当前文件所在目录的上两级目录（即 src/common）
current_dir = os.path.dirname(os.path.abspath(__file__))
common_dir = os.path.abspath(os.path.join(current_dir,'..', '..','src'))
sys.path.append(common_dir)


from pycapabilitydecorator  import capability

# ########################################
# # -- 最简单能力接入


# 设置访问路径
# @capability.option(
#     pages = [
#         "/simple_page1"
#     ],
#     description="最简单方法")


#最简单
@capability.option()
def simple_function():
    """

    https://blog.csdn.net/shanxuanang/article/details/147592336

    python capability_simple.py  simple_function

    python capability_simple.py  register

    python capability_simple.py  server    #启动服务器

    .venv/Scripts/activate.ps1 capability_simple.py  server

    http://127.0.0.1:5000/methods?method=simple_function


    cd .\examples\

    uv run capability_simple.py  server

    """
    # print(f"[simple_function] 执行 "
    return {
        "code": 0,
        "msg": "OK",
        "data": "这是最简单的能力"
    }


@capability.option()
def simple_function_by_get_params(params):
    '''
    http://127.0.0.1:5000/methods?m=simple_function&p=eyJ0aW1lc3RhbXAiOjE3NTM3NTY1MTExMDl9

    '''
    return {
        "code": 0,
        "msg": "OK",
        "data": f"这是简单的入参{params}"
    }
